package com.iut.sujet1.application;

import java.util.Scanner;

import com.iut.sujet1.manager.PersonneManager;
import com.iut.sujet1.metier.Personne;


public class Ex2 {

	public static void main(String[] args) {
		final int tailleCarnet = 50;
		Personne tabPers[] =  new Personne[tailleCarnet];
		int i = 0;
		int exit = 0;
		char choix = 'N';
		Personne pers = new Personne();
		PersonneManager pm = new PersonneManager();
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		
		do{
			exit++;
			pers = pm.SaisirPersonne();
			pers.setId(i);
			tabPers[i] = pers;
			
			i++;
			
			System.out.println("Quiter ? [O/N]");
			choix = sc.next().charAt(0);
			if(choix == 'O' || choix == 'o'){
				exit = -1;
			}
		}while(exit < tailleCarnet && exit > 0 );
		
		for (int j = 0; j < i; j++) {
			System.out.println(tabPers[j]);
		}
		
		System.out.println("Aurevoir");
	
	
	}	

	

}
